package com.qf.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;
import java.util.Set;

/**
 * @author YDW
 * projectName:project2202_4
 * time:2022/6/21 9:04
 * description:
 */
@FeignClient("sms-platform-cache")
@RequestMapping("/cache")
public interface CacheFeign {
    @RequestMapping(value = "/hgetStr/{key}/{field}", method = RequestMethod.POST)
    public String hgetStr(@PathVariable(value = "key") String key, @PathVariable(value = "field") String field);

    @RequestMapping(value = "/get/{key}", method = RequestMethod.GET)
    public String get(@PathVariable("key") String key);

    @RequestMapping(value = "/hmget/{key}", method = RequestMethod.GET)
    public Map hMGet(@PathVariable("key") String key);

    @GetMapping("/keys/{key}")
    public Set<String> keys(@PathVariable(value = "key") String key);

    @RequestMapping(value = "/save2cache", method = RequestMethod.POST)
    public boolean set(@RequestParam("key") String key, @RequestParam("value") String value, @RequestParam("expireSecond") Long expireSecond);

    @RequestMapping(value = "/hmset/{key}", method = RequestMethod.POST)
    public boolean hMSet(@PathVariable("key") String key, @RequestBody Map map);
}